package com.xiaocg.facade;

public class SmartFacade {
    private Light light;
    private TV tv;

    public SmartFacade() {
        this.light = new Light();
        this.tv = new TV();
    }

    public void say(String name){
        if (name.contains("打开")){
            on();
        }else if(name.contains("关闭")){
            close();
        }else {
            System.out.println("无法理解");
        }
    }

    private void  on(){
        light.on();
        tv.on();
    }

    private void  close(){
        light.close();
        tv.close();
    }


}
